package zhihui.mobile.manager.shop;

import zhihui.mobile.manager.IManager;

/**
 * Created by 张公铭 on 2017/8/22 0022.
 */
public class ShopCartManager implements IManager
{
    private static ShopCartManager manager;
    private int curCartCount = 0;  //购物车数量

    private ShopCartManager()
    {

    }

    private synchronized static void onCreated()
    {
        if (manager == null)
        {
            manager = new ShopCartManager();
        }
    }

    public static ShopCartManager getInstance()
    {
        if (manager == null)
        {
            onCreated();
        }
        return manager;
    }

    public int getCurCartCount()
    {
        return curCartCount;
    }

    public synchronized void setCurCartCount(int curCartCount)
    {
        this.curCartCount = curCartCount;
    }

    public void clear()
    {
        manager = null;
    }
}
